package com.atugigu.demo.customer.mapper;

import com.atugigu.demo.customer.bean.Customer;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;


@Mapper
@DS("mysql0408")
public interface CustomerMapper extends BaseMapper<Customer> {


    //#{ } 会根据对象属性的值类型 自动推断 是否使用单引  会把特殊符号和关键词 转义
    //${ } 不会推断 只是单纯的替换
    @Insert("insert into customer values(#{cus.id},#{cus.name},#{cus.age}  )")
    @DS("mysql0111")
    public  void insertCustomer(@Param("cus") Customer customer);

    @Select("select id,name,age from customer where id=#{id}")
    public Customer selectCustomerById(@Param("id")String customerId);
}
